package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.inspect.BPInspectPoint;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface BPInspectPointRepository extends JpaRepository<BPInspectPoint, Long> , JpaSpecificationExecutor {

    Page<BPInspectPoint> findAll(Pageable pageable);

    BPInspectPoint findByInspectName(String inspectName);

    @Query(value = "SELECT * FROM wwyt_bp_inspect_point WHERE inspect_location =?1 AND location_type = ?2 AND delete_flag = '0'",nativeQuery = true)
    List<BPInspectPoint> findByInspectLocationAndLocationType(String code, String nfc);
}
